home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Dialectic 1.2 / source / Dialectic ƒ / Shell ƒ / graphics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  3.5 KB  |  90 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        graphics.h
  4.  
  5. Purpose:    This is the header file for graphics.c
  6.  
  7. \**********************************************************************/
  8.  
  9. #include "QDOffscreen.h"
  10.  
  11. typedef struct
  12. {
  13.     int                    windowIndex;            /* index of window in program's window list */
  14.     int                    windowWidth;            /* width of window content, in pixels */
  15.     int                    windowHeight;            /* height of window content, in pixels */
  16.     int                    windowType;                /* type of window (see IM Essentials, 4-80) */
  17.     Boolean                hasCloseBox;            /* window has a close box */
  18.     Boolean                offscreenNeedsUpdate;    /* TRUE if offscreen bitmap needs redrawing */
  19.     Point                initialTopLeft;            /* initial window bounds when opened */
  20.     Rect                windowBounds;            /* on screen rectangle of window content */
  21.     Str31                windowTitle;            /* pascal string, title of window */
  22. } WindowDataRec, *WindowDataPtr, **WindowDataHandle;
  23.  
  24. typedef int (*dispatchProcPtr)(WindowDataHandle theData, int theMessage, unsigned long misc);
  25.  
  26. typedef struct                                    /* exactly the same as WindowDataRec */
  27. {                                                /* + dispatchProc at end */
  28.     int                    windowIndex;
  29.     int                    windowWidth;
  30.     int                    windowHeight;
  31.     int                    windowType;
  32.     Boolean                hasCloseBox;
  33.     Boolean                offscreenNeedsUpdate;
  34.     Point                initialTopLeft;
  35.     Rect                windowBounds;
  36.     Str31                windowTitle;
  37.     dispatchProcPtr        dispatchProc;            /* called with message of windowish event */
  38. } ExtendedWindowDataRec, *ExtendedWindowDataPtr, **ExtendedWindowDataHandle;
  39.  
  40. enum                    /* messages passed to window's dispatch procedure */
  41. {
  42.     kNull=0,            /* on null event when window is active, frgrnd/bkgrnd */
  43.     kStartup,            /* on program startup */
  44.     kShutdown,            /* on program shutdown */
  45.     kInitialize,        /* just before window is created & shown */
  46.     kOpen,                /* just after window is created & shown */
  47.     kUpdate,            /* during window update -- draw contents to current grafport */
  48.     kClose,                /* just before window is closed -- this can cancel close */
  49.     kDispose,            /* just after window is closed/disposed */
  50.     kActivate,            /* on window activate event */
  51.     kDeactivate,        /* on window deactivate event */
  52.     kSuspend,            /* on program suspension (switched into background) */
  53.     kResume,            /* on program resuming (switching into foreground) */
  54.     kKeydown,            /* on keydown event when window is active & in foreground */
  55.     kMousedown            /* on mousedown event in window content when active & in frgrnd */
  56. };
  57.  
  58. enum                    /* return codes from window dispatch procedure */
  59. {
  60.     kSuccess=0,            /* message handled, no further processing please */
  61.     kFailure,            /* message not handled, use default action if any */
  62.     kCancel                /* message refused, cancel action (only good with kClose) */
  63. };
  64.  
  65. /***************************************************************************************/
  66.  
  67. enum                    /* window indices in gTheWindow[] and gTheWindowData[] lists */
  68. {
  69.     kAbout=0,            /* about box */
  70.     kAboutMSG,            /* "About MSG" splash screen */
  71.     kHelp,                /* help window */
  72.     kClipboard            /* clipboard window */
  73. };
  74.  
  75. #define        NUM_WINDOWS                4        /* total number of windows (see above enum) */
  76.  
  77. extern    WindowPtr        gTheWindow[NUM_WINDOWS];
  78. extern    ExtendedWindowDataHandle
  79.                         gTheWindowData[NUM_WINDOWS];
  80.  
  81. Boolean InitTheGraphics(void);
  82. void ShutDownTheGraphics(void);
  83. void OpenTheWindow(int index);
  84. void GetMainScreenBounds(void);
  85. int GetWindowDepth(ExtendedWindowDataHandle theData);
  86. void UpdateTheWindow(ExtendedWindowDataHandle theData);
  87. Boolean CloseTheWindow(ExtendedWindowDataHandle theData);
  88. void DrawThePicture(PicHandle *thePict, int whichPict, int x, int y);
  89. void ReleaseThePict(PicHandle *thePict);
  90.